home *** CD-ROM | disk | FTP | other *** search
/ SGI Desktop Special Edition 1.1 / SGI Desktop Special Edition 1.1.iso / dist / SoftWindows2.idb / usr / lib / SoftWindows2 / cgi-bin / reg_echo.cgi.z / reg_echo.cgi
Encoding:
Text File  |  1995-11-13  |  4.9 KB  |  267 lines

  1. #!/usr/sbin/perl
  2.  
  3. # This is a small script to echo the contents of the
  4. # SoftWindows 2.0 Registration Form so that users can print the information
  5.  
  6. require "lib.pl";
  7.  
  8. MAIN:
  9. {
  10. # Read in all the variables set by the form
  11.   &ReadParse(*input);
  12.  
  13. # Print the header
  14.   print &PrintHeader;
  15.   if ($input{'name'} eq "" || $input{'phone'} eq "" ||
  16.       $input{'email_addr'} eq "") {
  17. print <<INSUFFICIENT_INFO;
  18. <title>Insufficient Information</title>
  19. <p>Sorry, to register, we at least need your name, email and phone.
  20. <p><a href="../reg_card1.html">Re-Register</a>
  21. INSUFFICIENT_INFO
  22.     exit;
  23.     }
  24.  
  25.   print "<html><head>\n";
  26.   print "<title>SoftWindows 2.0 Warranty Registration Card</title>\n";
  27.   print "</head>\n<body>\n";
  28.  
  29. $hostname = `/usr/bsd/hostname` ;
  30. $hostidstring = `/usr/lib/SoftWindows2/FLEXlm/lmhostid`;
  31. ($junk1, $hostid, $junk2) = split(/"/,$hostidstring) ;
  32. open(DATA, "/sbin/hinv |") || &CantGetInfo ;
  33.  
  34. # Do some processing, and print some output
  35.   ($text = $input{'text'}) =~ s/\n/\n<BR>/g; 
  36.                                    # add <BR>'s after carriage returns
  37.                                    # to multline input, since HTML does not
  38.                                    # preserve line breaks
  39.   print <<ENDOFTEXT;
  40.  
  41. <center>
  42. <H1>Warranty Registration Card</H1>
  43. <hr size=3 width=50% noshade>
  44. <h3> User Information </h3>
  45. <hr size=3 width=50% noshade>
  46. <table>
  47. <tr>
  48.         <th align=right>
  49.         Name
  50.         </th>
  51.         <td>
  52.         $input{'name'}
  53.         </td>
  54. </tr>
  55. <tr>
  56.         <th align=right>
  57.         Company
  58.         </th>
  59.         <td>
  60.         $input{'company'}
  61.         </td>
  62. </tr>
  63. <tr>
  64.         <th align=right>
  65.         Street Address
  66.         </th>
  67.         <td>
  68.         $input{'str_addr'}
  69.         </td>
  70. </tr>
  71. <tr>
  72.         <th align=right>
  73.         City 
  74.         </th>
  75.         <td>
  76.         $input{'city'}
  77.         </td>
  78. </tr>
  79. <tr>
  80.         <th align=right>
  81.         State
  82.         </th>
  83.         <td>
  84.         $input{'state'}
  85.         </td>
  86. </tr>
  87. <tr>
  88.         <th align=right>
  89.         Zip
  90.         </th>
  91.         <td>
  92.         $input{'zip'}
  93.         </td>
  94. </tr>
  95. <tr>
  96.         <th align=right>
  97.         Country 
  98.         </th>
  99.         <td>
  100.         $input{'country'}
  101.         </td>
  102. </tr>
  103. <tr>
  104.         <th align=right>
  105.         Phone 
  106.         </th>
  107.         <td>
  108.         $input{'phone'}
  109.         </td>
  110. </tr>
  111. <tr>
  112.         <th align=right>
  113.         Fax
  114.         </th>
  115.         <td>
  116.         $input{'fax'}
  117.         </td>
  118. </tr>
  119. <tr>
  120.         <th align=right>
  121.         Email Address
  122.         </th>
  123.         <td>
  124.         $input{'email_addr'}
  125.         </td>
  126. </tr>
  127. </table>
  128. <p>
  129. <hr size=3 width=50% noshade>
  130. <h3> System Information </h3>
  131. <hr size=3 width=50% noshade>
  132. <table>
  133. <tr>
  134.         <th align=right>
  135.          Server host ID or workstation host ID
  136.         </th>
  137.         <td>
  138.         $hostid
  139.         </td>
  140. </tr>
  141. <tr>
  142.         <th align=right>
  143.          Server name or workstation name 
  144.         </th>
  145.         <td>
  146.         $hostname
  147.         </td>
  148. </tr>
  149. <tr>
  150.         <th align=right>
  151.          Hardware
  152.         </th>
  153.         <td>
  154.         $input{'hardware1'} $input{'hardware2'}
  155.         </td>
  156. </tr>
  157. <tr>
  158.         <th align=right>
  159.          Operating System
  160.         </th>
  161.         <td>
  162.         $input{'os1'} $input{'os2'} 
  163.         </td>
  164. </tr>
  165. <tr>
  166.         <th align=right>
  167.         Network(s)
  168.         </th>
  169.         <td>
  170.         $input{'network1'} $input{'network2'} $input{'network3'} $input{'network4'} $input{'network5'}
  171.         </td>
  172. </tr>
  173. </table>
  174.  
  175. ENDOFTEXT
  176.  
  177. print <<ENDOFTEXT ;
  178. <p>
  179. <hr size=3 width=50% noshade>
  180. <h3 align=center>
  181.         hinv for $hostname
  182. </h3>
  183. <hr size=3 width=50% noshade>
  184.  
  185. <center>
  186. <table>
  187. ENDOFTEXT
  188.  
  189. while( <DATA> )
  190. {
  191.         ($name, $value) = split(':', $_, 2) ;
  192.         print <<ENDOFTEXT ;
  193. <tr>
  194.         <th align=right>
  195.                 $name
  196.         </th>
  197.         <td>
  198.                 $value
  199.         </td>
  200. </tr>
  201. ENDOFTEXT
  202. }
  203. # close(DATA) ;
  204.  
  205. print <<ENDOFTEXT ;
  206. </table>
  207.  
  208. <p>
  209. <hr size=3 width=50% noshade>
  210. <p>
  211. Please print and either mail or fax to Insignia Solutions
  212. <p>
  213. </center>
  214. In the Americas, Canada and the Pacific Rim, fax to 415-694-3705.
  215. In Europe, Scandinavia, the Middle East and Africa, fax to
  216. +44 131 451 6981.  Or mail the information to the appropriate Insignia
  217. Solutions office:
  218. <p>
  219. <b>North America</b>
  220. <pre>
  221.     Insignia Solutions
  222.     1300 Charleston Road
  223.     Mountain View, CA  94043
  224. </pre>
  225.  
  226. <b>United Kingdom</b>
  227. <pre>  
  228.     Insignia Solutions European Response Centre
  229.     P.O. Box 12359
  230.     Edinburgh EH114GP, UK
  231. </pre>
  232.  
  233.  
  234. ENDOFTEXT
  235.  
  236. # Close the document cleanly.
  237.   print "</body></html>\n";
  238.  
  239. $h=`/sbin/hinv`;
  240. $a="mail swin_reg\@esd.sgi.com <<HERE
  241. Subject: Swin 2.0 registration
  242.  
  243.           Name  $input{'name'}
  244.        Company  $input{'company'}
  245. Street Address  $input{'str_addr'}
  246.           City  $input{'city'}
  247.          State  $input{'state'}
  248.            Zip  $input{'zip'}
  249.        Country  $input{'country'}
  250.          Phone  $input{'phone'}
  251.            Fax  $input{'fax'}
  252.  Email Address  $input{'email_addr'}
  253.         Sys ID  $hostid
  254.      Host name  $hostname
  255.       Hardware  $input{'hardware1'} $input{'hardware2'}
  256.  Operating Sys  $input{'os1'} $input{'os2'}
  257.        Network  $input{'network1'} $input{'network2'} $input{'network3'} $input{'network4'} $input{'network5'}
  258.  
  259. $h
  260.  
  261. HERE";
  262.  
  263. system($a);
  264.  
  265. }
  266.  
  267.